from collections import OrderedDict

from rest_framework.pagination import PageNumberPagination
from rest_framework.response import Response


class LuckyScportPagination(PageNumberPagination):
    page_size = 10
    page_query_param = "pageNo"
    page_size_query_param = 'pageSize'

    def get_paginated_response(self, data):
        return Response(OrderedDict([
            ('pageNo', self.page.number),
            ('pageSize', self.page.paginator.per_page),
            ('total', self.page.paginator.count),
            ('next', self.get_next_link()),
            ('previous', self.get_previous_link()),
            ('list', data)
        ]))
